<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>HomePage</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <link href="js/bootstrap.js" rel="stylesheet">
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>

<?php
include("/usr/local/apache2/htdocs/jibaiwang/lib/HomePage.php");
include('log4php/Logger.php');
$cfgfile = "/usr/local/apache2/htdocs/jibaiwang/admin/bootstrap/conf/config.ini";
$defarray = parse_ini_file($cfgfile, 1);
$qlogtag = $defarray["HomePage"]['qlogtag'];
Logger::configure($defarray["HomePage"]['qlogcfg']);
$logger = Logger::getLogger($qlogtag);
$host = $defarray["HomePage"]["host"];
$user = $defarray["HomePage"]["user"];
$pass = $defarray["HomePage"]["pass"];
$db = $defarray["HomePage"]["db"];
$dbh = new Sqlexecutor($host, $user, $pass, $db);
$s = new HomePage($dbh,$logger);
if($_REQUEST["submit"] == "1")
{
    $subject = $_REQUEST["subject"];
    $slogan = $_REQUEST["slogan"];
    $content = $_REQUEST["content"];
    $res = $s->update($subject, $slogan, $content);
}
$list = $s->getInfo();
$home_subject = $list["subject"]; 
$home_slogan = $list["slogan"]; 
$home_content = $list["content"]; 
?>

  <form class="form-horizontal" target="_self">
    <fieldset>
      <legend>添加首页信息</legend>
      <div class="control-group">
          <label class="control-label" for="subject">请输入标题</label>
            <div class="controls">
                <input type="text" name="subject" id="subject"  style="text-align:center" class="span5" value="<?php echo $home_subject;?>">
            </div>
      </div>
      <div class="control-group">
          <label class="control-label" for="slogan">请输入口号</label>
            <div class="controls">
                <input type="text" name="slogan" id="slogan" class="span5" style="text-align:center" value="<?php echo $home_slogan;?>">
            </div>
      </div>
      <div class="control-group">
          <label class="control-label" for="textarea">请输入正文</label>
            <div class="controls">
               <textarea class="input-xlarge span7" name="content" id="textarea" rows="10"><?php echo $home_content;?></textarea>
            </div>
      </div>
    </fieldset>
      <div style="padding-right:500px">
             <button style="right:500px margin-top:10px; margin-left:50px; margin-left:10px; margin-bottom:10px;" value="1" type="submit" name="submit" class="btn btn-warning btn-large" >提交</button>
      </div>
  </form>

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> -->
    <script src="js/jquery.js"></script>
    <script src="js/google-code-prettify/prettify.js"></script>
    <script src="js/bootstrap-transition.js"></script>
    <script src="js/bootstrap-alert.js"></script>
    <script src="js/bootstrap-modal.js"></script>
    <script src="js/bootstrap-dropdown.js"></script>
    <script src="js/bootstrap-scrollspy.js"></script>
    <script src="js/bootstrap-tab.js"></script>
    <script src="js/bootstrap-tooltip.js"></script>
    <script src="js/bootstrap-popover.js"></script>
    <script src="js/bootstrap-button.js"></script>
    <script src="js/bootstrap-collapse.js"></script>
    <script src="js/bootstrap-carousel.js"></script>
    <script src="js/bootstrap-typeahead.js"></script>
    <script src="js/application.js"></script>
    <script src="js/customize.js"></script>

<script>
$('.carousel').carousel({
    interval: 12000
})
</script>

</body>
</html>
